<?php

namespace App\Repositories;

use App\Models\NetworkExpress;

class NetworkExpressRepository extends BaseRepository
{
    public function model()
    {
        return NetworkExpress::class;
    }

    /**
     * 获取服务站关联网点列表
     * Date: 2018/05/10
     * @param $networkExpress_name
     * @param $owner_name
     * @param $phone
     * @author Tenny
     * @return \Illuminate\Database\Eloquent\Collection|static[]
     */
    public function getNetworkExpresses($networkExpress_name = false, $limit = false, $owner_name = false, $phone = false)
    {
        if ($networkExpress_name !== false) {
            $this->where('designation', 'like', '%' . $networkExpress_name . '%');
        }
        if ($owner_name !== false) {
            $this->where('name', '=', $owner_name);
        }
        if ($phone !== false) {
            $this->where('phone', '=', $phone);
        }
        $couriers = $this->paginate($limit);
        return $couriers;
    }

    protected function serialization(array $attributes)
    {
        // TODO: Implement serialization() method.
    }
}